<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
    <meta charset="UTF-8">
    <title>往期活动详情页</title>
    <meta name="page-view-size" content="1280*720">
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/B_detailActivety.css">
    <script type="text/javascript" src="lib/js/evm.js"></script>
    <script type="text/javascript" src="lib/js/Evm_djyw.js"></script>
    <script type="text/javascript" src="lib/js/key.js"></script>
    <script src="lib/js/md5.js" type="text/javascript" charset="utf-8"></script>
    <script src="lib/js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="lib/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/api.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <style>
        .model:nth-child(4) {
            display: block;
            width: 100px;
            height: 35px;
            position: absolute;
            top: 450px;
            left: 170px;
            text-align: center;
            background: url(../images/like-1.png) no-repeat;
            background-position: top center;
            background-size: 60px 60px;
            padding-top: 80px;
            font-size: 15px;
            color: #fff;
        }
    </style>
</head>

<body>
    <div class="theoretical-bg" id="theoreticalMain">
        <div id="white-bg"></div>
        <div id="blue-bg"></div>
        <div class="model">
            <img class="imgs" src="" alt="">
            <!-- <div class="alearts">按确认键查看图集</div> -->
        </div>
        <div class="underImg">
            <div class="underimg">

                <div class="erweima">
                    <img class="erweimas" src="images/erweima.png" alt="">
                    <span>扫码分享</span>
                </div>
            </div>
        </div>
        <div class="status"><img class="status_img" src="" alt=""></div>
        <div class="info">
            <div class="title"></div>
        </div>
        <div class="item">
            <!-- <div class="baotime"></div> -->
            <div class="starttime"> <img src="/images/time.png"></div>
            <div class="organization"><img src="/images/team.png"></div>
            <div class="address"><img src="/images/address.png"></div>
            <div class="contacts"><img src="/images/person.png"></div>

            <div class="serviceTime"><img src="/images/time.png"></div>
            <div class="phone"><img src="/images/phone.png"></div>
            <!-- <div class="situation"></div> -->
            <!-- <div class="contacts"></div> -->
            <div>
                <div class="orange"><img src="/images/brief.png">活动简介</div>
            </div>
        </div>
        <div class="model">
            <div class="container" id="container">
                <div class="content" id="content">

                </div>
            </div>
        </div>
        <!-- <div class="bm_border">
			<div><img class="erweima" src="" alt=""></div>
			<div>微信扫码报名</div>
		</div> -->


        <div class="model" id="likes">
            <img src="./images/0_slices/1188.png" alt="">
            <p>100</p>
        </div>

        <div class="model">
            <span>招募志愿者</span>
        </div>

    </div>
</body>
<script>
    var modelIndex = {
        disUser: true,
        specialState: 'didi',
        index: 2, //初始位置
        listName: 'model', //模块名称
        containerId: 'theoreticalMain', //包含模块的标签id
        thisContain: 'container', //翻滚外容器
        thisDetail: 'content', //翻滚内容
    }
    var articleRun;

    function getMessage() {
        var param = {
            id: TV.GetParam('id'),
            area_id: $.cookie('TV_CST_AREA'),
            // access_token: $.cookie("TV_CST_TOKEN"),

        }
        GetDatas('getActivity', param, function(err, res) {
            mess = res.data;
            console.log(mess, 'likes')

            $('.endtime').append(" <div class=orange>结束时间</div>: " + mess.format_end_time);
            $('.starttime').append(" <div class=orange>活动时间</div>: " + mess.format_start_time + ' 至 ' + mess
                .format_end_time);
            $('.organization').append('<div class=orange>发起组织</div>：' + mess.group_name)
            $('.address').append('<div class=orange>活动地点</div>：' + mess.address);
            $('.serviceTime').append('<div class=orange>服务时长</div>：' + mess.service_time);
            $('.phone').append('<div class=orange>联系电话</div>：' + mess.phone);
            $('.contacts').append('<div class=orange>联&nbsp;&nbsp;系&nbsp;&nbsp;人&nbsp;</div>: ' + mess.contacter + '');

            $("#likes p").html(mess.likes)

            $('.content').append(mess.content);
            $('.plannum').html(mess.person_limit || "不限");
            $('.completenum').html(mess.joiner.length || "0");
            $('.status_img').attr("src", "images/rowstatus" + mess.status + ".png");



            $('.imgs').attr('src', mess.images ? API_URL.imgURL + mess.images : "/images/nonePic.png");
            // $('.').html(mess.);
            var surl = API_URL.loginURL + "home/index/qrcode?url=" + encodeURIComponent(
                API_URL.activityUrl + '/' + TV.GetParam('id'))
            $('.erweimas').attr('src', surl)
        })
    }

    getMessage();

    function direOpt(index, directive) {
        if (index == 1) { //文章翻滚
            TV.articleMove(directive, modelIndex.thisContain, modelIndex.thisDetail);
        }
        if (directive == "up") { //上
            if (index == 3) {
                index = 2
            }
            console.log('toptop')


        } else if (directive == "down") { //下
            if (index == 1) { //文章翻滚
                TV.articleMove(directive, modelIndex.thisContain, modelIndex.thisDetail);
            }
            console.log('downdown', index)
            if (index == 2) {
                index = 3
            }

        } else if (directive == "backwards") { //左
            if (index == 1) {
                index = 2
                clearInterval(articleRun)
            }

        } else if (directive == "forwards") {
            if (index == 2) {
                index = 1
            } else if (index == 3) {
                index = 1
            }

        }
        return index;
    }

    function direEnter(index) {
        console.log(index)
        if (index == 0) {} else if (index == 1) { //点单预约
            var params = {
                id: TV.GetParam('id'),
                name: EVM.cookie.getValue('TV_CST_NAME'),
                mobile: EVM.cookie.getValue('TV_CST_MOBILE'),
                access_token: $.cookie('TV_CST_TOKEN'),
            }
            if (mess.status == 2) {
                GetDatas('like', params, function(err, res) {
                    resOpt.call(this, res)
                });
            } else {
                if (mess.is_bm == "99") {
                    GetDatas('getReservation', params, function(err, res) {
                        resOpt.call(this, res)
                    });
                } else {
                    GetDatas('like', params, function(err, res) {
                        resOpt.call(this, res)
                    });
                }

            }

        } else if (index == 2) {
            var params = {
                    id: TV.GetParam('id'),
                    name: EVM.cookie.getValue('TV_CST_NAME'),
                    mobile: EVM.cookie.getValue('TV_CST_MOBILE'),
                    access_token: $.cookie('TV_CST_TOKEN'),
                }
                // if (mess.status == 1) {
            GetDatas('like', params, function(err, res) {
                resOpt.call(this, res)
            });
            // }
        } else if (index == 3) {
            var params = {
                id: TV.GetParam('id'),
                access_token: $.cookie('TV_CST_TOKEN'),
            }
            GetDatas('activityJoin', params, function(err, res) {
                if (res.code == 0) {
                    TV.PromptMsg("报名成功");

                } else {
                    TV.PromptMsg(res.message);

                }
            });



        }

    }

    function resOpt(res) {
        if (res.code == 0) {
            TV.PromptMsg("点赞成功");
            $("#likes p").html(res.data.likes)

        } else if (res.code == 10002) {
            TV.userLogin();
            direEnter(index);
        } else {
            TV.PromptMsg(res.message)
        }
    }
</script>
<script type="text/javascript" src="js/index.js"></script>

</html>